<template>
  <el-pagination
      background
      layout="total, prev, pager, next, jumper"
      :current-page="pageNum"
      :page-size="pageSize"
      :total="total"
      @current-change="onPageChange"
      style="text-align: center; margin-top: 20px;"
  />
</template>

<script>
export default {
  name: "pager",
  props: {
    pageNum: {
      type: Number,
      required: true
    },
    pageSize: {
      type: Number,
      default: 10
    },
    total: {
      type: Number,
      required: true
    }
  },
  methods: {
    onPageChange(newPage) {
      // 向父组件发送页码变化事件
      this.$emit("page-change", newPage);
    }
  }
};
</script>

<style scoped>
</style>
